<template>
  <div>
    <h1 ref="h1Ref">哈哈哈</h1>
    <button @click="change">修改h1</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';

let h1Ref = ref(null);
console.log(h1Ref);
const change = () => {
  if (h1Ref.value) {
    h1Ref.value.innerHTML = 123;
  }
};
</script>
